Let's look at starting first. Starting begins when Cloud Run pulls a container image and ends when the container
starts to serve web requests. Here are some questions
you can ask yourself, while we go through
the next few slides. Where does Cloud Run get the container image from
if it starts a container? When does Cloud Run start to forward request to a container? Starting a container
requires four steps. Cloud Run corrects the
container's root file system by materializing the
container image. Once the container
file system is ready, Cloud Run runs the
entry point program of the container i.e.,
your application. While your application
is starting, Cloud Run continuously
probes port 8080 to check whether your
application is ready. You can change the port
number, if you need to. Once your application starts
accepting TCP connections, Cloud Run forwards incoming web request
to your container. Cloud Run considers a container ready as soon as it
accepts TCP connections. You can also use a TCP
based readiness check, so make sure that your
application only opens the port when it's ready
to handle requests. Where does Cloud Run pull
container images from? The answer is Cloud Run pulls container images from
internal storage. There are two
distinct events when Cloud Run pulls a
container image. The first is when you deploy a container image
for the first time, the second is when Cloud
Run starts a container. If you deploy a new
container image, Cloud Run pulls and copies the container image
from Artifact Registry. Cloud Run then stores
the entire image in its internal storage and every time it starts
a new container, it pulls the container
image from there. This internal storage is
optimized to make sure that large container images load
just as fast as tiny ones, because Cloud Run copies the container images and also insulates your
service from failures in Artifact Registry or
when you accidentally remove a deployed container
image from Artifact Registry.